<?
 $img = base_url().'/templates/icon/';
 $up_img = "<img border=\"0\" src=\"".$img."up.gif\" />";
 $do_img = "<img border=\"0\" src=\"".$img."down.gif\" />";    
 $attributes = array('class' => 'email', 'id' => 'checknew');
 echo form_open('product/delscat', $attributes);
?>

<input type="hidden" name="page" value="<?=(int)$this->uri->segment('3')?>">
<table class="admindata">
   <thead>
      <tr>
         <th colspan="5"> <input type="submit" onclick="return verify_del();" name="btn_submit" value="Xóa">
            Hiện có
            <?=$num?>
            Trong <span class="pages">
            <?=$pagination?>
            </span> </th>
      </tr>
      <tr>
         <th class="checkbox"><input type="checkbox" name="sa" id="sa" onclick="check_chose('sa', 'ar_id[]', 'checknew')" /></th>
         <th>ID</th>
         <th>Tên danh mục</th>
         <th width="150">Sắp xếp</th>
         <th class="publish">Active</th>
      </tr>
   </thead>
   <?
            $k=1;
            foreach($list as $rs):
					$listsub = $this->product->getListSub($rs->CategoryID);
					$up   = anchor('product/cat_up/'.$rs->CategoryID, $up_img, array('title' => "Chuyển lên"));
					$down = anchor('product/cat_down/'.$rs->CategoryID, $do_img, array('title' => "Chuyển xuống"));            
            ?>
   <tr class="row<?=$k?>">
      <td><input type="checkbox" name="ar_id[]" value="<?=$rs->CategoryID?>"></td>
      <td><?=$rs->CategoryID?></td>
      <td><a href="<?=site_url('product/listcat/'.$rs->CategoryID)?>"><b>
         <?=$rs->CategoryName?>
         </b></a></td>
      <td><?=$up?>
         <?=$down?></td>
      <td align="center"><?=icon_edit('product/editcat/'.$rs->CategoryID)?>
         <span id="publish<?=$rs->CategoryID?>">
         <?=icon_active("'category'","'CategoryID'",$rs->CategoryID,$rs->bl_active)?>
         </span>
         <?=icon_del('product/delcat/'.$rs->CategoryID.'/'.(int)$this->uri->segment(4))?></td>
   </tr>
   <? 
				if(count($listsub) > 0)
				{
                $i=1;
                foreach($listsub as $rs):
                $listsub1 = $this->product->getListSub($rs->CategoryID);
                $up1   = anchor('product/cat_up/'.$rs->CategoryID, $up_img, array('title' => "Chuyển lên"));
                $down1 = anchor('product/cat_down/'.$rs->CategoryID, $do_img, array('title' => "Chuyển xuống"));                
            ?>
   <tr class="row<?=$i?>">
      <td><input type="checkbox" name="ar_id[]" value="<?=$rs->CategoryID?>"></td>
      <td><?=$rs->CategoryID?></td>
      <td><a style="padding-left: 10px;" href="<?=site_url('product/listcat/'.$rs->CategoryID)?>"> |_
         <?=$rs->CategoryName?>
         </a></td>
      <td><div>
            <?=$up1?>
            <?=$down1?>
         </div></td>
      <td align="center"><?=icon_edit('product/editcat/'.$rs->CategoryID)?>
         <span id="publish<?=$rs->CategoryID?>">
         <?=icon_active("'category'","'CategoryID'",$rs->CategoryID,$rs->bl_active)?>
         </span>
         <?=icon_del('product/delcat/'.$rs->CategoryID.'/'.(int)$this->uri->segment(4))?></td>
   </tr>
   <? if(count($listsub1) > 0){
                $j=1;
                foreach($listsub1 as $rs):
					 	$listsub2 = $this->product->getListSub($rs->CategoryID);
                	$up2   = anchor('product/cat_up/'.$rs->CategoryID, $up_img, array('title' => "Chuyển lên"));
                	$down2 = anchor('product/cat_down/'.$rs->CategoryID, $do_img, array('title' => "Chuyển xuống"));                  
            ?>
   <tr class="row<?=$j?>">
      <td><input type="checkbox" name="ar_id[]" value="<?=$rs->CategoryID?>"></td>
      <td><?=$rs->CategoryID?></td>
      <td><a style="padding-left: 30px;" href="<?=site_url('product/listcat/'.$rs->CategoryID)?>"> |__
         <?=$rs->CategoryName?>
         </a></td>
      <td><div>
            <?=$up2?>
            <?=$down2?>
         </div></td>
      <td align="center"><?=icon_edit('product/editcat/'.$rs->CategoryID)?>
         <span id="publish<?=$rs->CategoryID?>">
         <?=icon_active("'category'","'CategoryID'",$rs->CategoryID,$rs->bl_active)?>
         </span>
         <?=icon_del('product/delcat/'.$rs->CategoryID.'/'.(int)$this->uri->segment(4))?></td>
   </tr>
   <? if(count($listsub2) > 0){
							 $k=1;
							 foreach($listsub2 as $rs):
								//$listsub2 = $this->product->getListSub($rs->CategoryID);
								$up3   = anchor('product/cat_up/'.$rs->CategoryID, $up_img, array('title' => "Chuyển lên"));
								$down3 = anchor('product/cat_down/'.$rs->CategoryID, $do_img, array('title' => "Chuyển xuống"));                  
						?>
   <tr class="row<?=$k?>">
      <td><input type="checkbox" name="ar_id[]" value="<?=$rs->CategoryID?>"></td>
      <td><?=$rs->CategoryID?></td>
      <td><a style="padding-left: 60px;" href="<?=site_url('product/listcat/'.$rs->CategoryID)?>"> |__
         <?=$rs->CategoryName?>
         </a></td>
      <td><div>
            <?=$up3?>
            <?=$down3?>
         </div></td>
      <td align="center"><?=icon_edit('product/editcat/'.$rs->CategoryID)?>
         <span id="publish<?=$rs->CategoryID?>">
         <?=icon_active("'category'","'CategoryID'",$rs->CategoryID,$rs->bl_active)?>
         </span>
         <?=icon_del('product/delcat/'.$rs->CategoryID.'/'.(int)$this->uri->segment(4))?></td>
   </tr>
   <?
							 endforeach;
							 $k=$k-1;
						}?>
   <?
                   endforeach;
                   $j=$j-1;
               }?>
   <?
                endforeach;
                $i=$i-1;
            }?>
   <?
            $k=1-$k;
            endforeach;?>
   <tfoot>
   <td colspan="5"><input type="submit" onclick="return verify_del();" name="btn_submit" value="Xóa">
         Hiện có
         <?=$num?>
         <span class="pages">
         <?=$pagination?>
         </span></td>
         </tfoot>
</table>
<?=form_close()?>
